package 设计模式.factory2.pizza.order;



import 设计模式.factory2.pizza.pizza.Pizza;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;


public abstract class OrderPizza {
    public OrderPizza(){
        Pizza pizza=null;
        String orderType;
        do{
            orderType=getType();
            pizza=createPizza(orderType);
            pizza.prepare();
            pizza.bake();
            pizza.cut();
            pizza.box();
        }while (true);
    }
    //父方法
    abstract Pizza createPizza(String orderType);
    private String getType(){
        try {
            BufferedReader strin=new BufferedReader(new InputStreamReader(System.in));
            System.out.println("input 披萨种类");
            String str=strin.readLine();
            return str;
        }catch (IOException e){
            e.printStackTrace();
            return "";
        }
    }
}

